﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.SharePoint;

namespace AWS.SLAM.Hierarchy
{
    public class FeatureReceiver : SPFeatureReceiver
    {
        public override void FeatureInstalled(SPFeatureReceiverProperties properties) { }
        public override void FeatureUninstalling(SPFeatureReceiverProperties properties) { }

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            if (!InstallationValidator.VerifySlamIsInstalled())
            {
                throw new Exception("SharePoint List Association Manager (SLAM) is required to use this feature.  SLAM does not appear to be installed.  Please download SLAM from CodePlex at http://slam.codeplex.com/ then install and set it up prior to attempting to activate this feature again.", null);
            }

            if (!InstallationValidator.VerifySlamIsActivated())
            {
                InstallationValidator.ActivateSlamFeature();
            }
        }

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { }
        
    }
}
